package Loganseabolt.blocks;

import java.util.Random;

import Loganseabolt.util;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFlowing;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class Dia  extends Block  {

	public Dia(int par1, Material par2Material) {
		super(par1, par2Material);
		this.setBlockUnbreakable();
		this.setCreativeTab(CreativeTabs.tabBlock);
		// TODO Auto-generated constructor stub
	}
	public void registerIcons(IconRegister iconReg)
    {
        blockIcon = iconReg.registerIcon("LoganSeaboltModBase:TRAP");
    }
	/**
     * Called whenever the block is added into the world. Args: world, x, y, z
     */
    public void onBlockAdded(World par1World, int par2, int par3, int par4) 
    {
    	super.onBlockAdded(par1World, par2, par3, par4);
    	if (!par1World.isRemote)
    	{
    		par1World.scheduleBlockUpdate(par2, par3, par4, blockID, 600);
    	}
	}
    
   
	public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
	{
		par1World.scheduleBlockUpdate(par2, par3, par4, blockID, 600);
			if (!par1World.isRemote)
            {
                    //par3EntityPlayer.entityDropItem(par1ItemStack, par2)
                //     Vec3 skeyPos = util.placeInFrontOfEntity(par3EntityPlayer, 1);
                    // skeyPos.yCoord = par2World.getPrecipitationHeight((int)skeyPos.xCoord,(int) skeyPos.zCoord);
                   // EntityLightningBolt skeley = (EntityLightningBolt)new EntityLightningBolt(par2World, skeyPos.xCoord, skeyPos.yCoord, skeyPos.zCoord);
					if (par1World.getBlockId(par2, par3-1, par4)== Block.obsidian.blockID)
						return;
						par1World.setBlock(par2, par3-1, par4, BlockFlowing.lavaMoving.blockID);
                    /*
                    skeley.setPosition(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ);
                    skeley.rotationYaw = par3EntityPlayer.rotationYaw - 90;
                    skeley.posX -= ((double)(MathHelper.cos(skeley.rotationYaw / 180.0F * (float)Math.PI) * 0.16F)) * 100;
                skeley.posZ -= ((double)(MathHelper.sin(skeley.rotationYaw / 180.0F * (float)Math.PI) * 0.16F)) * 100;
                */
                    
                   
                   //par2World.spaw(skeley);
            }
		}
	private boolean Activated = true;
	private int ticks = 0;
}
